home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
014
/
diskit.arc
/
DISKIT.DOC
next >
Wrap
Text File
|
1985-08-27
|
15KB
|
363 lines
DISKIT lets you look at what's on your disk, and make
changes to what you find there. You can look at the contents of
a disk file or a disk sector, in either ASCII (letters and
numbers a normal person can read) or hexadecimal (numbers
programmers and computers can read), or both--on the screen or
printed on a printer. It also lets you make changes to a disk
file or a disk sector, and do search and replace with ASCII or
hexadecimal strings. It runs under MS or PC-DOS, version 2.0 or
later. MS-DOS 2.0 path names can be used when entering the name
of the disk file to be dumped, changed, or searched.
To run DISKIT, type "DISKIT <RETURN>", without the quotation
marks. After a brief appeal to your sense of fairness, the
program presents you with the Main Menu:
------------------------------------------------------------------
DISKIT MAIN MENU
D - Display a disk directory.
F - Look at a File.
T - Look at a particular Track and sector.
C - Change a file or a track and sector.
S - Search and replace.
Q - Quit and exit program.
Enter choice:
------------------------------------------------------------------
DISKIT makes access to the Main Menu very easy. No matter
where you are in the program, if you press the <Esc> key, the
program will immediately return to the Main Menu.
D - Display the disk directories.
Before you look at a file, you may wish to check its name or
see which disk drive it's on. Typing a 'D' at the main menu will
display the directory of any disk drive.
F - Look at a file.
To look at a file on the disk, type an 'F'. You will then be
asked a series of questions on the screen.
First you will be asked the name of the file you wish to
dump. Any valid file with MS DOS 2.0 path names can be used. If
DISKIT is unable to open the file, it will repeat the question.
If the file you wish to look at is on drive B and you are logged
onto drive A, you must precede the file name with a 'B:'.
When the program asks you for the "beginning index," enter
the number of the byte you wish to begin with. If you simply
type a <RETURN>, DISKIT will begin at the beginning of the file.
The program next asks for the number of bytes you wish to
dump. Enter the number. If you type <RETURN>, DISKIT will dump
to the end of the file.
Then you are asked if you want the dump to be ASCII,
hexadecimal, or both. A <RETURN> gives you both.
If you want DISKIT to present the results on the screen,
just press <RETURN>. The program will display a screen at a
time, waiting until a key is pressed before going on to the
next screen.
If you want a printed copy, choose one of the printer
options. You can select continuous feed or a page at a time.
If your page length is the standard 11 inches, type an 'S' for
Standard. For other page lengths, type the number of lines you
want on a page, and press <RETURN>.
When dumping a file in ASCII, certain unprintable characters
are represented as follows:
UNPRINTABLE CHARACTER PRINTS AS
carriage return (hex 0D) \
line feed (hex 0A) n
null (hex 00) _
all other unprintable characters @
T - Look at a particular Track and Sector
Type a 'T' if you want to look at your disk by track and
sector instead of by file. DISKIT will ask for the track and
sector numbers instead of file name; thereafter, the program
works the same way as it does when you are looking at a file.
C - Change a file or a track and sector.
Before changing anything with DISKIT, it is a good idea to
back-up the diskette you wish to alter. DISKIT is a powerful
utility that lets you change data on your diskette. It should be
used with great care.
Typing a 'C' at the Main Menu will let you change data on your
disk. First, you are asked if you wish to change a file or a
specific track and sector. After a series of questions similar
to those for looking at a file, you will see a screen that looks
something like this:
------------------------------------------------------------------
File is diskit.doc
304: 65 e
288: 626F74682D2D6F6E207468652073637265656E206F72200D0A7072696E74656420
288: b o t h - - o n t h e s c r e e n o r p r i n t e d
RETURN - No change, go on to the next character.
(backspace) - No change, go back to previous character.
Esc - Go back to main menu or continue searching for a string.
Otherwise change the current character by entering either a
one character ASCII symbol or a 2 digit hexadecimal number.
Then press RETURN.
------------------------------------------------------------------
The screen shows the bytes surrounding the byte you want
to change, in ASCII and in hexadecimal. To move forward through
the file, just press <RETURN> until you get to the byte you wish
to alter. When you are there, typing a single character will
replace the selected byte with the character you typed. If you
type two characters, the byte will be replaced by the hexadecimal
value represented by the two characters.
To move through the line of characters, you can also use the
cursor keys to move to the left or the right, or use the <RETURN>
key to move to the right and the back-arrow key to move to the
left.
We recommend that you be careful in making changes on your
disk, because as soon as you make the change on the screen and
press <RETURN>, the program alters the disk. Of course, you can
always change it back, if you know what to change it back to.
S - Search and replace.
First you will be asked for the name of the file and the
place to begin searching. The screen will then look like this:
------------------------------------------------------------------
What do you want to look for? DISKIT
Do you want to replace it with anything? (Y or N): Y
What do you want to replace it with? diskit
DISKIT will create a new file called diskit.$$$, which will contain all
of the changes.
Press RETURN to continue, Esc to go back to menu.
If you want to enter a hexadecimal string, enter a \ first.
To enter a string that begins with \, enter two of them (\\).
------------------------------------------------------------------
In this example, we are looking for the string "DISKIT" and
replacing it with the lower case string "diskit". You can also
search for a hexadecimal string by preceding the string with a
"\". In this case we could have searched for the string
"\4449534B4954" and replaced it with "\6469736B6974". This would
have accomplished the same thing as entering "DISKIT" and
"diskit". If you actually want to search for a string that
begins with a "\" such as "\n", enter a double back slash, i.e.
"\\n".
If you just want to search without replacing, answer "N" to
the second question. DISKIT will then search for an occurence of
the string and when it is found, will display the Change screen
as if you had asked to make a change to the file at that point.
From there it works just as if you had chosen the 'C' option at
the main menu, except that when you are done, and have pressed
Esc, DISKIT will go on searching for the next occurence of the
string rather than returning to the main menu.
If the replace option is chosen, then the following screen
will appear as soon as an occurence of the search string is
found:
------------------------------------------------------------------
Searching for "DISKIT" in diskit.man ....
Here it is at byte 646 in diskit.man: DISKIT
Shall I replace it? (Y or N):
If you want to replace them all without being asked, type an 'A' for All.
To return to the main menu, press Esc.
------------------------------------------------------------------
DISKIT will display this screen every time it finds an
occurence unless you type an "A", in which case the program will
go on searching and replacing to the end of file without asking
for any more confirmation.
Program Development
Programmers can use DISKIT to look at the effects of their
program on the disk, to make sure input and output data are being
read and printed in the right place and in the right format.
Program developers who want to convert files from one program's
format to another, or to patch in to commercial applications--
templates for 1-2-3 or dBASE III, for example--can use DISKIT to
analyze the programs' data structure.
For example, suppose you wanted to translate a file you'd
created with WordStar into straight ASCII. A dump of the file
would produce something like this:
------------------------------------------------------------------
0: 20202020204449534B49D4206C6574F320796FF5206C6F6FEB2061F420776861
0: D I S K I T l e t s y o u l o o k a t w h a
32: 7427F3206FEE20796F75F2206469736BAC20616EE4206D616BE5208D0A636861
32: t ' s o n y o u r d i s k , a n @ m a k e @ n c h a
64: 6E6765F32074EF20776861F420796FF52066696EE4207468657265AE2020596F
64: n g e s t o w h a t y o u f i n @ t h e r e . Y o
96: F5206361EE206C6F6FEB2061F4207468E520636F6E74656E74F3206FE6208D0A
96: u c a n l o o k a t t h e c o n t e n t s o f @ n
128: E120646973EB2066696CE5206FF220E120646973EB20736563746F72AC2069EE
128: a d i s k f i l e o r a d i s k s e c t o r , i n
160: 206569746865F22041534349C920286C6574746572F320616EE4208D0A6E756D
160: e i t h e r A S C I I ( l e t t e r s a n d @ n n u m
192: 626572F320E1206E6F726D61EC20706572736FEE206361EE2072656164A9206F
192: b e r s a n o r m a l p e r s o n c a n r e a d ) o
224: F22068657861646563696D61EC20286E756D626572F3208D0A70726F6772616D
224: r h e x a d e c i m a l ( n u m b e r s @ n p r o g r a m
256: 6D6572F320616EE420636F6D7075746572F3206361EE207265616429AC206FF2
256: m e r s a n d c o m p u t e r s c a n r e a d ) , o r
------------------------------------------------------------------
We can see that the funny characters are the ones at the end
of words. For example, the first sentence should read, "DISKIT
lets you look at what's on your disk, and make changes to what
you find there." Notice that the words "and" and "find" both end
in an unprintable character, hexadecimal E4. We know it's
supposed to be a 'd', hex value 64. We subtract and find that
the character is 80 hex (128 decimal) more than the d.
You could write a program that would look for characters
greater than 128 and subtract 128 from them, producing normal
ASCII files from WordStar's idiosyncratic ones.
With Databases
If you use a database management program, DISKIT can help
you to recover damaged data, perform ad hoc file maintenance, or
unscramble indexes. For example, suppose you wanted to see how
DBASE II wrote its header records at the beginning of a file.
------------------------------------------------------------------
0: 0253000A0954DA0046495253540000000000004319B9AA004C41535400000000
0: @ S _ n @ T Z _ F I R S T _ _ _ _ _ _ C @ 9 * _ L A S T _ _ _ _
32: 000000431ED2AA004144445231000000000000431EF0AA004144445232000000
32: _ _ _ C @ R * _ A D D R 1 _ _ _ _ _ _ C @ p * _ A D D R 2 _ _ _
64: 000000431E0EAB00434954590000000000000043142CAB005354415445000000
64: _ _ _ C @ @ + _ C I T Y _ _ _ _ _ _ _ C @ , + _ S T A T E _ _ _
96: 000000430240AB005A49500000000000000000430A42AB0050484F4E45000000
96: _ _ _ C @ @ + _ Z I P _ _ _ _ _ _ _ _ C n B + _ P H O N E _ _ _
128: 00000043144CAB004B45595300000000000000433260AB000D00000000000000
128: _ _ _ C @ L + _ K E Y S _ _ _ _ _ _ _ C 2 ` + _ \ _ _ _ _ _ _ _
160: 0000000000000000000000000000000000000000000000000000000000000000
160: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
------------------------------------------------------------------
Without going into great detail, we can see that the first
few bytes are some kind of code, followed by the names of the
fields in each record of the database. If we look at a slightly
different screen dump, we can immediately see how the header
record is organized.
------------------------------------------------------------------
7: 0046495253540000000000004319B9AA
7: _ F I R S T _ _ _ _ _ _ C @ 9 *
23: 004C41535400000000000000431ED2AA
23: _ L A S T _ _ _ _ _ _ _ C @ R *
39: 004144445231000000000000431EF0AA
39: _ A D D R 1 _ _ _ _ _ _ C @ p *
55: 004144445232000000000000431E0EAB
55: _ A D D R 2 _ _ _ _ _ _ C @ @ +
71: 00434954590000000000000043142CAB
71: _ C I T Y _ _ _ _ _ _ _ C @ , +
87: 005354415445000000000000430240AB
87: _ S T A T E _ _ _ _ _ _ C @ @ +
103: 005A49500000000000000000430A42AB
103: _ Z I P _ _ _ _ _ _ _ _ C n B +
119: 0050484F4E4500000000000043144CAB
119: _ P H O N E _ _ _ _ _ _ C @ L +
135: 004B45595300000000000000433260AB
135: _ K E Y S _ _ _ _ _ _ _ C 2 ` +
151: 000D0000000000000000000000000000
151: _ \ _ _ _ _ _ _ _ _ _ _ _ _ _ _
167: 00000000000000000000000000000000
167: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
------------------------------------------------------------------
Beginning at byte 7, with a line length of 16 bytes, we can
see that the record length is 16 bytes, with the data type (in
this case C or N) in the 13th byte.
Other Things
We think DISKIT is a valuable tool. If you use it in a way
that you think is novel and neat, let us know. If we like your
idea, we'll incorporate it in the documentation and send you $25.
1-2-3 is a trademark of Lotus Development Corporation.
DBASE II and DBASE III are trademarks of Ashton-Tate, Inc.
WordStar is a trademark of MicroPro, Inc.